<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
<%@ page import="zillow.api.results.walkscore"%>
<%@ page import="zillow.api.results.LongLatService" %>

<jsp:useBean id="cb" scope="request" class="zillow.api.results.walkscore" />
<jsp:setProperty name="cb" property="*" />
<%@ page import="java.util.StringTokenizer" %>
	 <%
	 
	walkscore ws = new walkscore();
	String address = request.getParameter("address");
	StringTokenizer st = new StringTokenizer(address, ",");
	String street = st.nextToken();
	String city = st.nextToken();
	String state = st.nextToken();
	String walkscore_address = street+" "+city+" "+state;
	//System.out.println(address);
	LongLatService tDirectionService = new LongLatService();
    tDirectionService.getLongitudeLatitude(walkscore_address);
    //System.out.println(tDirectionService.getLat()+tDirectionService.getLong());
	String walkscore = ws.getWalkScore(walkscore_address,tDirectionService.getLat(),tDirectionService.getLong());
	StringTokenizer st2 = new StringTokenizer(walkscore, ",");
	String score = st2.nextToken();
	String description = st2.nextToken();
	//out.println(walkscore);
	 %>
	 
	<p><font face='Verdana, Arial, Helvetica, sans-serif' size='3' color='#fff'> 
	<a target='_blank' href='http://www.walkscore.com/live-more/#how-it-works?utm_medium=logo&utm_campaign=cl-badge'>
	<img border=0 style='border:0;' src='http://cdn2.walk.sc/images/walkscore-logo-baseline.gif' /></a></font> 
	<font face='Verdana, Arial, Helvetica, sans-serif' size='3'><b>
	<%out.println("  "+score);%><br>
    <% out.println("Walkability: "+description);%> </b></font>



</body>
</html>